<%= settings_layout do %>
  <h2 class="text-2xl font-bold">Credentials</h2>
  <hr class="mt-3 mb-4 border-t border-base-300" />

  <%= turbo_frame_tag "provider" do %>
    <%= render "providers/index" %>
    <div class="flex items-center gap-2">
      <%= link_to "+ Github Credentials", new_provider_path(provider_type: Provider::GITHUB_PROVIDER), class: "btn btn-primary btn-sm" %>
      <%= link_to "+ Gitlab Credentials", new_provider_path(provider_type: Provider::GITLAB_PROVIDER), class: "btn btn-primary btn-sm" %>
      <%= link_to "+ Container Registry Credentials", new_provider_path(provider_type: Provider::CUSTOM_REGISTRY_PROVIDER), class: "btn btn-primary btn-sm" %>

      <% if current_account.stack_manager&.stack&.provides_registries? %>
        <%= button_to sync_registries_stack_manager_path, class: "btn btn-outline btn-sm" do %>
          <iconify-icon icon="lucide:refresh-ccw" height="16"></iconify-icon>
          <span class="hidden sm:inline">Sync Credentials</span>
        <% end %>
      <% end %>
    </div>
  <% end %>

  <% if current_account.stack_manager&.portainer? && current_account.stack_manager.enable_role_based_access_control? %>
    <hr class="my-6 border-t border-base-300" />
    <%= render "providers/portainer_token" %>
  <% end %>
<% end %>